package com.qiaofang.dataprocessing.facade.impl;

import com.qiaofang.common.request.DataRequest;
import com.qiaofang.common.response.CommonResponse;
import com.qiaofang.common.response.DataResultResponse;
import com.qiaofang.dataprocessing.service.DataHandleService;
import com.qiaofang.dataprocessing.stub.facade.DataHandleFacade;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author QF2019
 */
@Slf4j
@RestController
public class DataHandleFacadeImpl implements DataHandleFacade {

    @Autowired
    private DataHandleService dataHandleService;

    @Override
    public CommonResponse updateCallCenterCompanyCode(@RequestBody DataRequest<String> request) {
        int count = dataHandleService.updateCallCenterCompanyCode(request.getParam());
        log.info("updateCallCenterCompanyCode，request:{},count:{}", request.getParam(), count);
        return DataResultResponse.ok(null);
    }

    @Override
    public DataResultResponse<String> getCallCenterCompanyCode() {
        return DataResultResponse.ok(dataHandleService.getCallCenterCompanyCode());
    }
}
